1. Field of the Invention
The present invention relates to database technologies, and more specifically to a method and apparatus for dynamically sizing buffers to optimal size in network layers when supporting data transfers related to database applications.
2. Related Art
Database applications are often implemented on a network. In an example scenario, a client system (of an application executing thereon) sends a query to either write or read data from a server system. Accordingly, data is transferred on the network from the client system to the server system in the case of a write operation and from the server system to the client system in the case of a read operation. The query can be between two server systems as well, even though the description is provided with respect to the combination of a client system and a server system. The client and server systems are commonly referred to as database systems.
To facilitate communication over the network, a network layer is generally implemented in each of the database systems. In general, the network provides an interface using which the higher layers on the database system can send (or receive) data to (from) another system with a network address. For example, in the case of Internet Protocol (IP) based networks, socket based interface represents such an interface with the network layer.
Buffers (“network buffer”) are often used in network layers to facilitate data transfers. In general, the higher layers store data in a network buffer, and the network layer then transfers the data in the network buffer. Similarly, even during receive operations, the received data is stored in a network buffer, and higher layers may then read the data from the network buffer.
The size of network buffers may impact the performance of various systems, which are implementing database applications. For example, in one embodiment, the data may be transferred only after a network buffer is full. Accordingly, if the buffer size is too large, the data may not be transferred to the system at the other end for a long duration, and an unacceptably low throughput performance may result.
On the other hand, if a buffer size is too small, the buffer may need to be filled multiple times to effect a large data transfer. According to one prior approach, system calls are used to place data into the buffer as well as for the network layer to transfer the data to the network. As system calls generally consume substantial system resources, the overall throughput performance of the systems may again be affected.
In one prior embodiment, the network buffer size is configured to be of a fixed size statically based on the system to which a connection is sought to be established. The buffer size may be specified by a configuration file maintained by a database administrator. One problem with such a static buffer size is that the network buffer may not be suitable for at least some of the data transfers between database systems.
In the drawings, like reference numbers generally indicate identical, functionally similar, and/or structurally similar elements. The drawing in which an element first appears is indicated by the leftmost digit(s) in the corresponding reference number.